<h3>Goods</h3>
<?php echo CHtml::link('Search Goods',array('goods/admin'));?>
<div class="box best-selling">
<table border="0" cellspacing="0">
<tbody>
<?php
        $data = $dataProvider->getData();
        $count = $dataProvider->getTotalItemCount();
        for($i = 0 ;4*$i<$count;$i = $i+1)
        {
                        echo '<tr class="odd">';
                                echo '<td><a href=""><img class="product-img" src="http://localhost/Eshop/admin/images/'.$data[4*$i]->goods_name.'.jpg" border="0" width="95" /></a>';
                                
                                echo '<div class="product-description">';
                                
                                echo '<p>Name:'.CHtml::link($data[4*$i]->goods_name,array('goods/view','id'=>$data[4*$i]->goods_id)).'</p>';
                                
                                echo '<p>';
                                
                                echo 'Price:'.CHtml::encode($data[4*$i]->goods_price).'</a>';
                                
                                echo '</p>';
                                
                                echo '<p>';
                                
                                echo 'Discount:'.CHtml::encode($data[4*$i]->goods_discount).'</a>';
                                
                                echo '</p>';
                                
                                echo '<p>'.CHtml::link('Add to cart',array('cart/create','goods_id'=>$data[4*$i]->goods_id)).'</p>';
                                echo '<p>'.CHtml::link('Add comments',array('comments/create','goods_id'=>$data[4*$i]->goods_id)).'</p>';
                                echo '</div>';
                                echo '</td>';
                                if(4*$i+1>=$count){
                                        echo '</tr>';
                                        break;
                                                
                                }
                               echo '<td><a href=""><img class="product-img" src="http://localhost/Eshop/admin/images/'.$data[4*$i+1]->goods_name.'.jpg" border="0" width="95" /></a>';
                                
                                echo '<div class="product-description">';
                                
                                echo '<p>Name:'.CHtml::link($data[4*$i+1]->goods_name,array('goods/view','id'=>$data[4*$i+1]->goods_id)).'</p>';
                                
                                echo '<p>';
                                
                                echo 'Price:'.CHtml::encode($data[4*$i+1]->goods_price).'</a>';
                                
                                echo '</p>';
                                echo '<p>';
                                
                                echo 'Discount:'.CHtml::encode($data[4*$i+1]->goods_discount).'</a>';
                                
                                echo '</p>';
                                
                                echo '<p>'.CHtml::link('Add to cart',array('cart/create','goods_id'=>$data[4*$i+1]->goods_id)).'</p>';
                                echo '<p>'.CHtml::link('Add comments',array('comments/create','goods_id'=>$data[4*$i+1]->goods_id)).'</p>';
                                echo '</div>';
                                echo '</td>';
                        echo '</tr>';
                                if(4*$i+2>=$count){
                                        break;
                                }
                        echo '<tr class="even">';
                                 echo '<td><a href=""><img class="product-img" src="http://localhost/Eshop/admin/images/'.$data[4*$i+2]->goods_name.'.jpg" border="0" width="95" /></a>';
                                
                                echo '<div class="product-description">';
                                
                                echo '<p>Name:'.CHtml::link($data[4*$i+2]->goods_name,array('goods/view','id'=>$data[4*$i+2]->goods_id)).'</p>';
                                
                                echo '<p>';
                                
                                echo 'Price:'.CHtml::encode($data[4*$i+2]->goods_price).'</a>';
                                
                                echo '</p>';
                                echo '<p>';
                                
                                echo 'Discount:'.CHtml::encode($data[4*$i+2]->goods_discount).'</a>';
                                
                                echo '</p>';
                                
                                echo '<p>'.CHtml::link('Add to cart',array('cart/create','goods_id'=>$data[4*$i+2]->goods_id)).'</p>';
                                echo '<p>'.CHtml::link('Add comments',array('comments/create','goods_id'=>$data[4*$i+2]->goods_id)).'</p>';
                                
                                echo '</div>';
                                echo '</td>';
                                if(4*$i+3>=$count){
                                        echo '</tr>';
                                        break;  
                                }
                                echo '<td><a href=""><img class="product-img" src="http://localhost/Eshop/admin/images/'.$data[4*$i+3]->goods_name.'.jpg" border="0" width="95" /></a>';
                                
                                echo '<div class="product-description">';
                                
                                echo '<p>Name:'.CHtml::link($data[4*$i+3]->goods_name,array('goods/view','id'=>$data[4*$i+3]->goods_id)).'</p>';
                                
                                echo '<p>';
                                
                                echo 'Price:'.CHtml::encode($data[4*$i+3]->goods_price).'</a>';
                                
                                echo '</p>';
                                echo '<p>';
                                
                                echo 'Discount:'.CHtml::encode($data[4*$i+3]->goods_discount).'</a>';
                                
                                echo '</p>';
                                
                                echo '<p>'.CHtml::link('Add to cart',array('cart/create','goods_id'=>$data[4*$i+3]->goods_id)).'</p>';
                                echo '<p>'.CHtml::link('Add comments',array('comments/create','goods_id'=>$data[4*$i+3]->goods_id)).'</p>';
                                
                                echo '</div>';
                                echo '</td>';
                                echo '</tr>';
        } 
?>
</tbody>
</table>
</div>
